package cn.hrlly.tao2shou.presenter;

import android.content.Context;

import cn.hrlly.tao2shou.biz.OperateOrderBiz;
import cn.hrlly.tao2shou.biz.OperateOrderBizImpl;
import cn.hrlly.tao2shou.domain.Orders;
import cn.hrlly.tao2shou.listener.OnOperateOrderListener;
import cn.hrlly.tao2shou.view.view_interface.OperateOrderView;

/**
 * User: gengliang
 * Date: 2016-01-31
 * Time: 19:09
 */

public class OperateOrderPresenterImpl implements OperateOrderPresenter,OnOperateOrderListener {

    private OperateOrderBiz operateOrderBiz;
    private OperateOrderView operateOrderView;

    public OperateOrderPresenterImpl(OperateOrderView operateOrderView,Context context) {
        this.operateOrderView = operateOrderView;
        this.operateOrderBiz=new OperateOrderBizImpl(this);
    }

    //以下是operateOrderPresenter
    @Override
    public void cancelUnfinishOrder() {
        Orders orders=new Orders();
        orders.setOrderId(operateOrderView.getOrderId());
        operateOrderBiz.cancelUnfinishOrder(orders);
    }

    @Override
    public void confirmCancelUnfinishOrder() {
        Orders orders=new Orders();
        orders.setOrderId(operateOrderView.getOrderId());
        operateOrderBiz.confirmCancelUnfinishOrder(orders);
    }

    @Override
    public void cancelCompletedOrder() {
        Orders orders=new Orders();
        orders.setOrderId(operateOrderView.getOrderId());
        operateOrderBiz.cancelCompletedOrder(orders);
    }

    //以下是onOperateOrderListener
    @Override
    public void operateOrderSucc(String messgae) {
        operateOrderView.showMessage(messgae);
    }

    @Override
    public void operateOrderSucc(int messgae) {
        operateOrderView.showMessage(messgae);
    }

    @Override
    public void operateOrderFail(String errorMessage) {
        operateOrderView.showMessage(errorMessage);
    }

    @Override
    public void operateOrderFail(int errorMessage) {
        operateOrderView.showMessage(errorMessage);
    }
}
